<template>
  <div id="app" :key="Key">
    <TopNav></TopNav>  
    <Headers></Headers>
    <!-- <img alt="Vue logo" src="./assets/logo.png"> -->
    <router-view></router-view>
    <Footers></Footers>
  </div>
</template>

<script>

// import Home from "./pages/Home"
import { router } from "./route/router"
import Headers from "./components/Headers"
import Footers from "./components/Footer"
import TopNav from "./components/TopNav"
export default {
  name: 'app',
  router,
  data() {
    return {
      Key:""//监听路由不变，参数变化时，页面不刷新的问题
    }
  },
  components: {
    "Headers":Headers,
    "Footers":Footers,
    "TopNav":TopNav,
  },
  watch: {
    $route:function(newUrl,oldUrl){
      // 路由发生变化时（包括参数），对Key进行赋值，如果Key发生了变化，则页面执行刷新
      this.Key=new Date().getTime();
    }
  },
}
</script>

<style>
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  color: #2c3e50;
  margin-top: 60px;
}
</style>
